import * as React from 'react';


const HookDemo: React.FC = () => {
  const [count, setCount] = React.useState(0);

  const handleClick = () => {
    setCount(count + 1)
  }

  const DelayClick = () => {
    setTimeout(() => {
      alert(count)
    }, 2000)
  }
  return (
    <div>
      {count}
      <button onClick={handleClick}>点击增加</button>
      <button onClick={DelayClick}>延时</button>
    </div>
  )
}

export default HookDemo